package com.example.teesystem.entityDto;

import com.example.teesystem.common.cache.CourseCache;
import com.example.teesystem.common.cache.UserCache;
import com.example.teesystem.entity.Assistant;
import com.example.teesystem.entity.User;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;

import java.util.Map;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class AssistantDto {

    /**
     * 课程id
     */
    private Integer courseId;

    /**
     * 课程名称
     */
    private String courseName;

    /**
     * 助教ID
     */
    private Integer assistantId;

    /**
     * 助教姓名
     */
    private String assistantName;

    /**
     * 助教账户
     */
    private String assistantAccount;

    /**
     * 助教权限
     */
    private Map<Integer,String> permission;

    /**
     * 创建教师ID
     */
    private Integer uploadId;

    public AssistantDto(Assistant assistant,Map<Integer,String> Permission){
        BeanUtils.copyProperties(assistant,this);
        this.permission = Permission;
        this.assistantName = UserCache.userMap.get(this.assistantId).getMyName();
        this.assistantAccount = UserCache.userMap.get(this.assistantId).getAccount();
        this.courseName = CourseCache.courseMap.get(this.courseId).getName();

    }

}
